﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using DevExpress.XtraEditors;
using System.IO.Ports;

namespace CIRDiagnoseDevice
{
    public partial class SingleModelTestFrm : Form
    {
        public SingleModelTestFrm()
        {
            InitializeComponent();
        }

        private void TranTestBn_Click(object sender, EventArgs e)
        {
            string[,] itemName = { {"载波频率容差","--", "≤5×10ˉ6" }, {"载波功率"," W" ,"5、10(+20%, -15%)"},{"调制特性(300Hz~3000Hz)","dB","+1, -3"},
                                               {"调制限制", "KHz","≤ 5"},{"高调制时的发射机频偏(5 KHz)","Hz","≤ 1500"},
                                               {"高调制时的发射机频偏(3 KHz~5 KHz)","--","单调下降"},{"调制灵敏度", "mV","245"},{"音频失真", "% "," ≤ 5"},{"剩余调频", "dB","≤ -40"}};
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("发射机性能指标测试", form);
            Thread.Sleep(10);
            form.InitGrid("1");
        }

        private void GSM_RDisFunTest_Click(object sender, EventArgs e)
        {
            string[] item = new string[] { "无线车次号上传", "调度命令接收", "进路预告命令接收" };
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("GSM-R数据模块功能试验", form);
            Thread.Sleep(10);
            form.LoadFunTestGrid("20");
        }

        private void SingleModelTestFrm_Resize(object sender, EventArgs e)
        {
           //  groupBox1.Location = new Point(0, 3);
            //groupBox1.Size = new Size(this.Width , this.Height /5);
            // groupBox2.Location = new Point(this.Width / 2 + 50, 3);
          //  groupBox2.Size = new Size(this.Width , this.Height / 5);
       //  groupBox3.Location = new Point(0, this.Height / 2 + 3 + 50);
           //  groupBox3.Size = new Size(this.Width , this.Height / 5);
         // groupBox4.Location = new Point(this.Width / 2 + 50, this.Height / 2 + 3 + 50);
          // groupBox4.Size = new Size(this.Width , this.Height / 5);
        }

        private void CoRecTestBn_Click(object sender, EventArgs e)
        {
            string[,] itemName = { {"参考灵敏度(单工)",  "μ V"," ≤ 0.6"},{"调制接收宽度", "KHz"," ≥2×5"},{"接收门限",  "μ V"," 0.6~5"},{"额定音频输出功率 (扬声器)"," W","0.5~5可调"},{"音频响应(扬声器)","dB","-8~2, "},
                                               {"额定音频输出功率 (耳机)","mW"," 1~10"}, {"音频失真",  "%"," ≤5"},{"音频响应(耳机)","dB","-3~1"}, {"信号对剩余输出功率比", "dB"," ≤-40"}};
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("同频接收机性能指标测试", form);
            Thread.Sleep(10);
            form.InitGrid("2");
        }

        private void PiRecTestBn_Click(object sender, EventArgs e)
        {
            string[,] itemName = { {"参考灵敏度(单工)",  "μ V"," ≤ 0.6"},{"双工灵敏度","μ V","不低于单工3dB"},{"调制接收宽度", "KHz"," ≥2×5"},{"接收门限",  "μ V"," 0.6~5"},{"额定音频输出功率 (扬声器)"," W","0.5~5可调"},{"音频响应(扬声器)","dB","-8~2, "},
                                               {"额定音频输出功率 (耳机)","mW"," 1~10"}, {"音频失真",  "%"," ≤5"},{"音频响应(耳机)","dB","-3~1"}, {"信号对剩余输出功率比", "dB"," ≤-40"}};// 
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("异频接收机性能指标测试", form);
            Thread.Sleep(10);
            form.InitGrid("3");
        }

        private void SigTestBn_Click(object sender, EventArgs e)
        {
            string[,] itemName ={ {"信号频偏(1520Hz)"," KHz","3 (容差+15%)"},{"信号频偏(114.8Hz)",  "KHz","0.5 (容差+15%)"},{"信号频偏(186.2Hz)",  "KHz","0.5 (容差+15%)"},
                                      {"信号频偏(123Hz)",  "KHz","0.5 (容差+15%)"},{"信号频偏(131.8Hz)",  "KHz","0.5 (容差+15%)"},{"信号频偏(151.4Hz)",  "KHz","0.5 (容差+15%)"},
                                      {"信号频偏(162.2Hz)",  "KHz","0.5 (容差+15%)"},{"信号频偏(173.8Hz)",  "KHz","0.5 (容差+15%)"},{"信号频率准确度(1520Hz)", "%","0.5"},
                                      {"信号频率准确度(114.8Hz)", "%","0.5"}, {"信号频率准确度(186.2Hz)", "%","0.5"}, {"信号频率准确度(123Hz)", "%","0.5"}, {"信号频率准确度(131.8Hz)", "%","0.5"},
                                      {"信号频率准确度(151.4Hz)", "%","0.5"}, {"信号频率准确度(162.2Hz)", "%","0.5"}, {"信号频率准确度(173.8Hz)", "%","0.5"},
                                     {"检出特性(114.8Hz 同频)","--","在6dB信纳比，频偏 0.5 KHz时,解码电路工作"}, {"检出特性(1960Hz)","--","在6dB信纳比，频偏 1.75KHz时，解码电路工作"},
                                    {"检出特性(114.8Hz 异频)","--","在6dB信纳比，频偏 0.5 KHz时,解码电路工作"},{"检出特性(114.8Hz +186.2Hz)","--","在6dB信纳比，频偏 0.5 KHz时,解码电路工作"} ,
                                    {"信号接收带宽(1960Hz)","%","低端： -2.5 ~ -1.5，高端：1.5 ~ 2.5"} , {"信号接收带宽(114.8Hz 同频)", "%","低端：-2.0 ~ -1.0，高端：1.0 ~ 2.0"}, 
                                    {"信号接收带宽(114.8Hz异频)", "%","低端： -2.0 ~ -1.0 ，高端：1.0 ~ 2.0"}};  // {"接收带宽(186.2Hz)", "%","低端： -2.0 ~ -1.0，高端：1.0 ~ 2.0"},
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("信令指标测试", form);
            Thread.Sleep(10);
            form.InitGroupGrid("4,5,6,7");
        }

        private void TrainEndFunBn_Click(object sender, EventArgs e)
        {
            string[] item = new string[] { "列尾连接确认", "风压查询", "排风制动", "风压报警", "欠压报警", "列尾消号" };
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("450MHz列尾功能试验", form);
            Thread.Sleep(10);
            form.LoadFunTestGrid("18");
        }

        private void LBJFunTestBn_Click(object sender, EventArgs e)
        {
            string[] item = new string[]{"KLW连接测试","KLW手动查询风压测试","KLW辅助排风制动测试","KLW风压报警测试","KLW电压报警测试",
                                                      "KLW取消连接测试","列车防护报警发送信息测试","列车防护报警接收信息测试","道口事故报警信息测试","施工防护报警信息测试"};
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("LBJ功能试验", form);
            Thread.Sleep(10);
            form.LoadFunTestGrid("17");
        }

        private void GSM_RVoTest_Click(object sender, EventArgs e)
        {
            string[,] itemName = { {"IMEI","---"},{"最大峰值功率","39dBm±2dB"},{"载波频率误差","≤89Hz"},{"峰值相位误差","≤20°"},
                                               {"均方根相位误差","≤5°"},{"发射机突发脉冲定时","突发脉冲功率时间包络应落在规定的包络曲线内"},{"接收灵敏度","优于-102dBm"}};
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("GSM-R语音模块电性能测试", form);
            Thread.Sleep(10);
            form.LoadGSMGrid("8,9,10");
        }

        private void GSM_RDigTest_Click(object sender, EventArgs e)
        {
            string[,] itemName = {{"IMEI","---"}, {"最大峰值功率","33dBm±2dB"},{"载波频率误差","≤89Hz"},{"峰值相位误差","≤20°"},
                                               {"均方根相位误差","≤5°"},{"发射机突发脉冲定时","突发脉冲功率时间包络应落在规定的包络曲线内"},
                                               {"接收灵敏度","优于-102dBm"}};
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("GSM-R数据模块电性能测试", form);
            Thread.Sleep(10);
            form.LoadGSMGrid("11,12,13");
        }

       
        private void DispatchFunBn_Click(object sender, EventArgs e)
        {
            string[] item = new string[]{"450MHz调度命令信息测试"};
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("450MHz调度命令功能试验", form);
            Thread.Sleep(10);
            form.LoadFunTestGrid("19");
        }

        private void Tran_800M_Click(object sender, EventArgs e)
        {
            string[,] item =   { {"866信道","载波频率容差","--", "≤5×10ˉ6" }, {"866信道","载波功率"," W" ,"3~10 可调"}, {"866信道","调制频偏(1.2 KHz)","KHz","3.0~3.5"},{"866信道","调制信号频率准确度(1.2 KHz)", "%","0.5"},
                                {"866信道","调制限制", "KHz","≤ 5"},{"866信道","剩余调频", "dB","≤ -40"},{"821信道","载波频率容差","--", "≤5×10ˉ6" }, {"821信道","载波功率"," W" ,"3~10 可调"},
                                     {"821信道","调制频偏(1.2 KHz)","KHz","4.2~4.8"} };// {"866信道","调制频偏(1.8 KHz)","KHz","3.0~3.5"},,{"866信道","调制信号频率准确度(1.8 KHz)", "%","0.5"}
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("LBJ发射机电性能测试", form);
            Thread.Sleep(10);
            form.InitGroupGrid("14,15");
        }

        private void Rec_800M_Click(object sender, EventArgs e)
        {
            string[,] item = { { "参考灵敏度", "μ V", " ≤ 0.6" }, { "调制接收宽度", "KHz", " ≥2×5" }, {"音频失真",  "%"," ≤5"}, {"信号对剩余输出功率比", "dB"," ≤-40"}};
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("LBJ接收机电性能测试", form);
            Thread.Sleep(10);
            form.InitGrid("16");
        }

        private void Train_Near_Click(object sender, EventArgs e)
        {
            string[] item = new string[]{"列车接近预警信息测试"};
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("列车接近预警功能试验", form);
            Thread.Sleep(10);
            form.LoadFunTestGrid("21");
        }


        private void Station_450M_Click(object sender, EventArgs e)
        {

        }

        private void Station_800M_Click(object sender, EventArgs e)
        {

        }

        public void SetBnImage(string formName)
        {
            if (formName == "发射机性能指标测试")
            {
                TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Yellow;
                SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
            }
            else if (formName == "同频接收机性能指标测试")
            {
                TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Yellow;
                TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
            }
            else if (formName == "异频接收机性能指标测试")
            {
                TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Yellow;
                DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
            }
            else if (formName == "信令指标测试")
            {
                TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Yellow;
                CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
            }
            else if (formName == "450M列尾功能试验")
            {
                TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Yellow;
                PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
            }
            else if (formName == "LBJ功能试验")
            {
                TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Yellow;
                Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
            }
            else if (formName == "GSM-R语音模块电性能测试")
            {
                TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Yellow;
                GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
            }
            else if (formName == "GSM-R数据模块电性能测试")
            {
                TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Yellow;
                GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
            }
            else if (formName == "GSM-R数据模块功能试验")
            {
                TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Yellow;
                Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
            }
            else if(formName == "LBJ发射机电性能测试")
            {
                TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Yellow;
                Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
            }
            else if (formName =="LBJ接收机电性能测试")

            {
                TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Yellow;
                Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
                GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Red;
            }
            else
            {
                this.Invoke(new MethodInvoker( delegate{
                    ResetButton();}));

            }
        }

        private void ResetButton()
        {
            TranTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            SigTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            CoRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            TrainEndFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            PiRecTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            DispatchFunBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            LBJFunTestBn.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            Tran_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            Rec_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            Train_Near.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            GSM_RVoTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            GSM_RDigTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            GSM_RDisFunTest.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            Station_450M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            Station_800M.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            GSM_RVoMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
            GSM_RDigMod.Image = CIRDiagnoseDevice.Properties.Resources.lamp_Green;
        }

        private void GSM_RVoMod_Click(object sender, EventArgs e)
        {
            string[,] itemName = { {"IMEI","---"},{"最大峰值功率","39dBm±2dB"},{"载波频率误差","≤89Hz"},{"峰值相位误差","≤20°"},
                                               {"均方根相位误差","≤5°"},{"发射机突发脉冲定时","突发脉冲功率时间包络应落在规定的包络曲线内"},{"接收灵敏度","优于-102dBm"}};
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("GSM-R语音模块单板电性能测试", form);
            Thread.Sleep(10);
            form.LoadGSMGrid("8,9,10");
            MainFrm.MotherFrm.IsGsmModTest = true;
            MainFrm.MotherFrm.Index = 0;
        }

        private void GSM_RDigMod_Click(object sender, EventArgs e)
        {
            string[,] itemName = {{"IMEI","---"}, {"最大峰值功率","33dBm±2dB"},{"载波频率误差","≤89Hz"},{"峰值相位误差","≤20°"},
                                               {"均方根相位误差","≤5°"},{"发射机突发脉冲定时","突发脉冲功率时间包络应落在规定的包络曲线内"},
                                               {"接收灵敏度","优于-102dBm"}};
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("GSM-R数据模块单板电性能测试", form);
            Thread.Sleep(10);
            form.LoadGSMGrid("11,12,13");
            MainFrm.MotherFrm.IsGsmModTest = false;
            MainFrm.MotherFrm.Index = 0;
        }

        private void btn_heluqi_Click(object sender, EventArgs e)
        {
            string[,] itemName = { { "三合一单元", "450M插入损耗检测", "≤1.2dB" }, { "三合一单元", "800M插入损耗检测", "≤1.2dB" }, { "三合一单元", "GSM-R插入损耗检测", "≤1.2dB" }, { "二合一单元", "450M插入损耗检测", "≤1.2dB" }, { "二合一单元", "GSM-R插入损耗检测", "≤1.2dB" }, };
            SingleModFrm form = new SingleModFrm();
            MainFrm.MotherFrm.AddTabPage("合路器测试", form);
            Thread.Sleep(10);
            form.InitHeLUQiGrid("22,23");
        }
    }
}
